home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr23 / tlxtw204.zip / HANGUP.SLT < prev    next >
Text File  |  1995-01-21  |  6KB  |  198 lines

  1. //-----------------------------------------------------------------------//
  2. //  hangup.slt  alt-h
  3. //  TLXTW hangup script
  4. //  see lines 30 and 52
  5. //-----------------------------------------------------------------------//
  6. //  When using TLXTW 2.x Scripts, press alt-h once to reset the script
  7. //  directory, pressing alt-h again will hang up the modem.
  8. //  To get back to TLXTW's directory after pressing alt-h once, assign
  9. //  "@e:\telix\scripts\tlxtw\tlxtwdir.slc"  (check the path here) to a F-key
  10. //  and save in Telix.key.
  11. //  Compile with CS.EXE.  Ex:  cs hangup.slt
  12. //-----------------------------------------------------------------------//
  13. int     statline, statline_color, h, x, y;
  14.  
  15. main()
  16. {
  17.     int i;
  18.  
  19.     if(cinp_cnt())
  20.         flushbuf();
  21.     _scr_chk_key = 0;
  22.     _back_color = 0;
  23.     _fore_color = 7;
  24.     get_statline();
  25.     update_term();
  26.     newdir(_telix_dir);
  27. //---------------------------------------------------------------------------//
  28. // this is your normal script directory                                      //
  29. //                                                                           //
  30. _script_dir = "e:\TELIX\WORK\SLC\";                                          //
  31. //                                                                           //
  32. //---------------------------------------------------------------------------//
  33.     if( (i=keyload("telix.key")) > -1 )         // reload default .key file
  34.         printsc("^M^JTelix.key loaded." );
  35.     else
  36.         printsc( "^M^JError loading Telix.key" );
  37.  
  38.     printsc("^M^JScript directory: ");
  39.     printsc( _script_dir );
  40.  
  41.     if ( capture_stat() == 1 || capture_stat() == 2 ) {
  42.         if( capture ( "*close*" ) > -1 ) {
  43.             printsc( "^M^JCapture file    : " );
  44.             printsc( _capture_fname );
  45.             printsc( " closed." );
  46.         }
  47.     }
  48.  
  49. //---------------------------------------------------------------------------//
  50. // normal capture filename                                                   //
  51. //                                                                           //
  52. _capture_fname = "e:\tmp\cap";                                               //
  53. //                                                                           //
  54. //---------------------------------------------------------------------------//
  55.     if( carrier() ) {
  56.         printsc( "^M^JCapture file    : " );
  57.         if( capture( _capture_fname ) > -1 ) {
  58.             printsc( _capture_fname );
  59.             printsc( " opened." );
  60.         }
  61.         else {
  62.             printsc( "Error opening " );
  63.             printsc( _capture_fname );
  64.         }
  65.     }
  66.  
  67.     prints("");
  68.  
  69.     //hangup_();    // comment out if you do not want to hangup the modem.
  70.  
  71.     cursor_onoff(1);
  72.     clean_tempdir();
  73.  
  74.     _scr_chk_key = 1;
  75.     return 1;
  76. }
  77. //-----------------------------------------------------------------------//
  78. hangup_()
  79. {
  80.     int i;
  81.  
  82.     if ( carrier() ) {
  83.         i=0;
  84.         while( i == 0 && inkey() != 27 ) {
  85.             i=hangup();
  86.             vrstrarea(h);
  87.             if(i > 0)
  88.                 break;
  89.             gotoxy( 0, y );
  90.             delay_scr(10);
  91.             cputs_tr(_mdm_hang_str);
  92.             if (waitfor("OK", 3) ) break;
  93.             delay_scr(5);
  94.         }
  95.     }
  96.     vrstrarea(h);
  97.     pstraxy( _entry_name, 0, statline, statline_color);
  98.     gotoxy(0, y);
  99.     while ( inkey() != 27 ) {
  100.         cputs_tr(_mdm_init_str);
  101.         if ( waitfor("OK", 2 )) break;
  102.         delay_scr(2);
  103.     }
  104. }
  105. //-----------------------------------------------------------------------//
  106. clean_tempdir()//delete unwanted files in the temp directory
  107. {
  108.     str tempdir[64],buf[64];
  109.     int f;
  110.  
  111.     if(!getenv("temp",tempdir)) {
  112.         soft_wind("^"Temp^" Environment variable not found!",30);
  113.         return 0;
  114.     }
  115.     newdir(tempdir);
  116.     fdelete("Entrynam.txt");
  117.     // add any more files here
  118.     newdir(_telix_dir);
  119.     return 1;
  120. }
  121. //-----------------------------------------------------------------------//
  122. append_backslash( str string )
  123. {
  124.     if(subchr(string,strlen(string)-1)!='\')strcat(string,"\");
  125.     return string;
  126. }
  127. //-----------------------------------------------------------------------//
  128. chk_stat ( int statchk )
  129. {
  130.     int c, x, y;
  131.  
  132.     x=getx(); y=gety();
  133.     gotoxy(67, statchk);
  134.     if ((c=vgetchr() & 255) == 79 ){
  135.         Statline = statchk;
  136.         statline_color = c/256;
  137.         gotoxy(x,y);
  138.         return 1;
  139.     }
  140.     else {
  141.         gotoxy(x,y);
  142.         return 0;
  143.     }
  144. }
  145. //-----------------------------------------------------------------------//
  146. get_statline()
  147. {
  148.     if      (chk_stat( 0) ) return  0;
  149.     else if (chk_stat(24) ) return 24;
  150.     else if (chk_stat(43) ) return 43;
  151.     else if (chk_stat(50) ) return 50;
  152.   //else prints("^m^jUnable to find the status line" );
  153.     return -1;
  154. }
  155. //-----------------------------------------------------------------------//
  156. ps( str message )
  157. {
  158.     int x,y;
  159.  
  160.     x=getx(); y=gety();
  161.     pstraxy("                                                      │",0,statline,statline_color);
  162.     pstraxy(message,0,statline,statline_color);
  163.     gotoxy( x,y );
  164.     return 0;
  165. }
  166. //-----------------------------------------------------------------------//
  167. psx( str message, int row )
  168. {
  169.     int x,y;
  170.  
  171.     x=getx();y=gety();
  172.     pstraxy(message,row,statline,statline_color);
  173.     gotoxy( x,y );
  174.     return 0;
  175. }
  176. //-----------------------------------------------------------------------//
  177. soft_wind(str message, int duration)
  178. {
  179.     int old_chk_key;
  180.     old_chk_key = _scr_chk_key;
  181.     _scr_chk_key = 0;
  182.     int l, h, x, y, key = 0, ts;
  183.     cursor_onoff(0);
  184.     x=getx(); y=gety();
  185.     l = strlen(message)/2;
  186.     h = vsavearea(37-l, 10, 43+l, 14);
  187.     box(37-l, 10, 43+l, 14, 3, 0, 5 );
  188.     pstraxy(message, 40-l  , 12, 11 );
  189.     ts = timer_start(duration);
  190.     while( !key && !time_up(ts)) key=inkey();
  191.     vrstrarea(h);
  192.     cursor_onoff(1);
  193.     gotoxy(x,y);
  194.     timer_free(ts);
  195.     _scr_chk_key = old_chk_key;
  196.     return key;
  197. }
  198.